<template>
  <div class="header">
    <div class="header__back">
      <div class="iconfont">&#xe60a;</div>
    </div>
    <div class="header__search">
      <span class="iconfont">&#xe64c;</span>
      <input placeholder="输入城市/景点/游玩主题" type="search" />
    </div>
    <router-link tag="div" to="/city" class="header__city">
      <span>{{this.currentCity}}</span>
      <span class="iconfont">&#xe6aa;</span>
    </router-link>
  </div>
</template>

<script type="text/ecmascript-6">
import { mapState } from 'vuex'
export default {
  name: 'Header',
  computed: {
    ...mapState({
      currentCity: 'city'
    })
  }
}
</script>

<style lang="scss" scoped>
  @import "~styles/scss/variable.scss";
  .header{
    display: flex;
    align-items: center;
    height: $header-default-height;
    background: $color-primary;
    color: #fff;
    &__back{
      height: $header-default-height;
      line-height: $header-default-height;
      padding: 0 .3rem 0 .1rem;
    }
    &__search{
      flex: 1;
      & input[type="search"] {
        width: 100%;
        height: .6rem;
        border-radius: .08rem;
        background: #fff;
        text-indent: .5rem;
        color: $color-text-dark;
        border: none;
      }
      & .iconfont {
        position: absolute;
        color: #ccc;
        margin: 7px 5px 5px 5px;
      }
    }
    &__city{
      padding: .2rem;
      font-size: $fontSize-regular;
    }
  }
</style>
